#pragma once

#ifndef _SCOPE_H_
#define _SCOPE_H_

#include "wfx.h"
#include "tuple.h"

#include "SymbolTable.h"


MAKE_PTR(CScope);

ATTRIBUTE(_tag_parent_scope, CScopePtr);
ATTRIBUTE(_tag_symbol_table, CSymbolTablePtr);
ATTRIBUTE(_tag_execute, bool);


class CScope : public tuple
{
public:
	static CScopePtr create(
		CScopePtr		pParentScope = CScopePtr(),
		CSymbolTablePtr pSymbolTable = CSymbolTablePtr()
		)
	{
		return CScopePtr(new CScope(pParentScope, pSymbolTable));
	}

public:

	CScope(
		CScopePtr		pParentScope = CScopePtr(),
		CSymbolTablePtr pSymbolTable = CSymbolTablePtr()
		)
	{
		this->setParentScope(pParentScope);

		pSymbolTable = pSymbolTable ? pSymbolTable : CSymbolTable::create();
		this->setSymbolTable(pSymbolTable);

		this->setExecute(true);
	}

public:




	/************************************************************************/
	/* Property Access                                                      */
	/************************************************************************/
public:

	CSymbolTablePtr getSymbolTable()
	{
		return this->get<_tag_symbol_table>();
	}

	void setSymbolTable(CSymbolTablePtr pSymbolTable)
	{
		this->set<_tag_symbol_table>(pSymbolTable);
	}

	CScopePtr getParentScope()
	{
		return this->get<_tag_parent_scope>();
	}

	void setParentScope(CScopePtr pParentScope)
	{
		this->set<_tag_parent_scope>(pParentScope);
	}

	bool getExecute()
	{
		return this->get<_tag_execute>();
	}

	void setExecute(bool bExecute)
	{
		this->set<_tag_execute>(bExecute);
	}

};



#endif // #ifndef _SCOPE_H_